                                <dd><form action="#" method="post" enctype="multipart/form-data" id="something" class="uniForm"><input name="new_image" id="new_image" type="file" class="uploadavatar" /><input type="submit" name="submit" value="Carica immagine" class=""></form></dd>
<?php
    if(isset($_POST['submit'])){
        if (isset ($_FILES['new_image'])){
            $imagename = 'avatar.png';
            $source = $_FILES['new_image']['tmp_name'];
            $target = "./template/img/".$imagename;
            move_uploaded_file($source, $target);
            $imagepath = $imagename;
            $save = "./template/img/" . $imagepath;
            $file = "./template/img/" . $imagepath;
            echo '<script language=javascript>document.location.href="./index.php"</script>';
        }
    }
?>